#!/bin/bash
echo "这是一个懒人linux基础包(ubuntu/debian)!"
echo "这是一个懒人linux基础包(ubuntu/debian)!"
echo "这是一个懒人linux基础包(ubuntu/debian)!"
echo "1.修改软件源"
echo "2.修改DNS服务器"
echo "3.快速安装1panel（含docker）"
echo "4.添加Docker镜像加速"
echo "5.更新armbian-software（选装）"
# 定义文件保存路径为当前目录（/mnt）
SCRIPT_DIR="/mnt"

# 下载并执行修改软件源的脚本
curl -o "${SCRIPT_DIR}/software_sources.sh" https://gitee.com/xiao-lin1314/linux/raw/master/curl_shell/panther%20x2/Modifying_software_sources.sh
chmod +x "${SCRIPT_DIR}/software_sources.sh"
"${SCRIPT_DIR}/software_sources.sh"

# 下载并执行修改DNS服务器的脚本
curl -o "${SCRIPT_DIR}/Modifying_nameserverr.sh" https://gitee.com/xiao-lin1314/linux/raw/master/curl_shell/panther%20x2/Modifying_nameserverr.sh
chmod +x "${SCRIPT_DIR}/Modifying_nameserverr.sh"
"${SCRIPT_DIR}/Modifying_nameserverr.sh"

# 执行快速安装脚本
sudo curl -sSL https://resource.fit2cloud.com/1panel/package/quick_start.sh -o quick_start.sh && bash quick_start.sh

# 下载并执行Docker镜像加速脚本
curl -o "${SCRIPT_DIR}/docker_more_fast.sh" https://gitee.com/xiao-lin1314/linux/raw/master/curl_shell/panther%20x2/pull_docker_more_fast.sh
chmod +x "${SCRIPT_DIR}/docker_more_fast.sh"
"${SCRIPT_DIR}/docker_more_fast.sh"

echo "是否更新armbian-software（黑豹x2专用）? 默认否[yes/no]"
read -r user_input

if [[ $user_input == "yes" ]]; then
  echo "Updating package lists..."
  sudo apt update
  echo "Upgrading installed packages..."
  sudo apt upgrade -y
  # 如果 armbian-software 是一个可执行文件或者命令，那么直接运行
  if command -v armbian-software &> /dev/null; then
    echo "Running armbian-software..."
    sudo armbian-software
  else
    echo "armbian-software command not found, skipping."
  fi
fi
echo "结束。。。。。。。。。。"
echo "执行过程中下载的脚本存放目录（/mnt）下"